#map的应用(映射)了解
l=['alex','lxx','wxx','xxq']
new=(name+'_dsb' for name in l)

new_l=[name+'_dsb' for name in l]
print(new_l)

res=map(lambda name:name+'',l)
print(list(res))
#print(res.__next__())#<map object at 0x000002A1572E1A20> 生成器

l=['alex_sb','abc','lxx_sb','wxx','xxq']
res=[name for name in l if name.endswith('sb')]
print(res)

res=filter(lambda x:len(x)>3,l)
print(list(res))
#print(res.__next__()) #StopIteration
#reduce 了解
from functools import reduce
res=reduce(lambda x,y:x+y,[1,2,3],10)
print(res)


def add_three(x):
    if x % 2 == 0:
        return True
    else:
        return False


li = [1, 2, 3, 4, 5, 6, 7, 8]

print([i for i in filter(add_three, li)])

li = [1, 2, 3, 4, 5, 6, 7, 8]

print([i for i in filter(lambda x: x % 2 == 0, li)])


























